Introduction

Interface

Start Menu

Control Panel

Accessories

Hardware

Tweaking Windows 98

Help

Visit the PC Plus WWW site

The Windows Scripting Host (WSH) - Overview

See also - Using the Windows Scripting Host  and Writing WSH Scripts

Scripts - mini-programs that are 'hosted' by other programs - are one of Microsoft's key developer technologies. You can write scripts to control the Office applications (Word, Excel etc), and the Internet Explorer browser. More ambitiously, you can use them to dynamically generate HTML pages in the NT-based Internet Information Server. Scripts can be written in a variety of different scripting languages, and can vary in length and complexity from two or three statements to two or three hundred.

The Windows Scripting Host (WSH) brings scripting to the Windows desktop, allowing you to execute script files by double-clicking on them as if they were .EXE file programs. The WSH itself is 'language neutral', which means that it provides a framework for scripts to communicate with Windows and other applications, but hands the interpretation of the script languages to plug-in 'scripting engines'. Microsoft ships engines for two scripting languages with Win 98 - VBScript (a dialect of Visual Basic), and JScript (its version of JavaScript). It's also hoping that other companies will produce engines for popular scripting languages such as REXX and Perl.

See the first scripting host movieWSH scripts can perform two broad types of operation. First, they can control Windows 98 itself, performing operations on the desktop, filing system, registry and local network. For example, a script can create a file, shortcut or folder, copy a file, associate a file type with an application, and even map a network drive onto a local drive letter (e.g. E:). Click here to see a ScreenCam movie showing this kind of scripting operation.

In the second type of operation, scripts can act as (OLE) Automation controllers, loading applications and taking detailed control of their actions. Scripts running within applications have been able to do this for some time, for example when a script running in Microsoft Word controls the actions of Microsoft Excel. Now these scripts can be free-standing, and launched directly from the desktop. Whereas the Office applications (and other packages, such as Lotus SmartSuite) can only use one scripting language (typically Visual Basic or a similar dialect), WSH allows you to control applications from JavaScript routines, and in any other languages supported by third-party engines. See the second scripting host movieClick here to see a ScreenCam movie showing a script controlling an application.

A single script can include both types of operation, for example copying and renaming a file then loading an application to process it.

Windows Scripting Host and MS-DOS batch files.

Since its earliest days, MS-DOS has featured a 'batch file' language. This allows you to create simple scripts (in .BAT files) which can copy files, set environment variables, load applications and so on. Although WSH is a logical successor to the batch file language, batch files are still fully supported by Windows 98, and all your existing .BAT files will run unchanged.

Introduction | Top | Help